﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Gfw.Web.Common
{
    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, Inherited = true, AllowMultiple = true)]
    public class PauseServiceAttribute : FilterAttribute, IActionFilter
    {
        public void OnActionExecuted(ActionExecutedContext filterContext)
        {

        }

        public void OnActionExecuting(ActionExecutingContext filterContext)
        {
            // var v = Params.SecondVerify;
            if ( DateTime.Now.Hour < 1)
            {

                //  string redirectOnSuccess = filterContext.HttpContext.Request.Url.AbsolutePath;
                /// string redirectUrl = string.Format("?ReturnUrl={0}", redirectOnSuccess);
                filterContext.Result = new RedirectResult("~/Pause");
                return;
            }
            else
            {
                //验证一次以后就失效，哈哈，还是多高级的
                // Params.SecondVerify = false;
            }
        }

        
    }

}